package com.mcb_wxc.service.wxPay;

import java.io.*;

/**
 * Created by 小生
 * 2019/4/13 7:37.
 */

public class MyConfig extends WXPayConfig {
    private byte[] certData;
    private static String resourcesUrl = System.getProperty("user.dir")+"/xfj_wxc/src/main/resources/wxpay/";
    public MyConfig() throws Exception {
        //获取绝对路径
        String certPath = resourcesUrl+"apiclient_cert.p12";
        certPath = certPath.replace("\\","/");
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();
    }

    public String getAppID() {
        return "wxfd753794e86d02d8";
    }

    public String getMchID() {
        return "1226127602";
    }

    public String getKey() {
        return "PmADGwX82e8lWU8bPmADGwX82e8lWxfj";
    }

    @Override
    IWXPayDomain.DomainInfo getDomainInfo() {
        return null;
    }

    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }

    @Override
    IWXPayDomain getWXPayDomain() {
        return new IWXPayDomainImp();
    }
}
